home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / MacSerialPortHardware.txt < prev    next >
Text File  |  1997-01-04  |  14KB  |  308 lines

  1. This document contains notes on the Macintosh serial port and its use, with
  2. concentration on hardware interface issues. Last updated 12/7/94
  3.  
  4. Macintosh Serial Port Hardware
  5.  
  6. DANGER WARNING WILL ROBINSON!!!
  7.  
  8. The DB-25 on the back of a Macintosh is NOT a serial port, it is a SCSI
  9. parallel port. Any attempt to use this connector as a serial port will NOT
  10. function correctly and may cause damage to the Macintosh and/or the
  11. equipment being connected.
  12.  
  13. The two serial ports of a Macintosh are mini-Din-8 connectors which are
  14. labeled with a telephone (the "modem port") and a printer ("printer port").
  15. This is the pinout of the serial connectors. We are looking at the back of
  16. the Macintosh (or alternatively at the BACK of a male plug):
  17.  
  18.              Macintosh Plus Serial Connectors (Mini-DIN-8)
  19.  
  20.        /------###------\         1 HSKo          Output Handshake
  21.      /        ###        \                        (Zilog 8530 DTR pin)
  22.    /                       \     2 HSKi / Clock  Input Handshake or extern clk
  23.   /     [|]   [|]   [|]     \                     (Depending on 8530 mode)
  24.  /       8     7     6       \   3 TxD-          Transmit data (minus)
  25. |                             |
  26. |                             |  4 Ground        Signal ground
  27. |     ===       ===    ===    |
  28. |      5         4      3     |  5 RxD-          Receive data (minus)
  29. |                             |
  30. |                             |  6 TxD+          Transmit data (plus)
  31.  \----+    ===   ===    +----/
  32.   \###|     2     1     |###/    7 GPIn          General purpose input
  33.    \##|                 |##/
  34.      \|                 |/       8 RxD+          Receive data (plus)
  35.        \------###------/
  36.               ###
  37.  
  38. Note this is a RS-422 interface so the signals come in a balanced pair, a
  39. positive (plus) and a negative (minus), for each data signal. As we shall
  40. see below, there is an easy method for matching this to RS-232. Also note
  41. that the General Purpose Input on pin 7 is not implemented on the Mac Plus
  42. or earlier machines.
  43.  
  44. We have given up soldering our own mini-Din-8 connectors. They cost $3.75
  45. and they are just the pits to work with. We now buy 12 foot mini-Din-8 to
  46. mini-Din-8 cables for $10.00 from the Diskette Gazette people and cut them
  47. in half. Voila, two 6 foot mini-Din-8 to bare wire cables for $5.00 each. We
  48. solder on the DB-25 side and do the wire permutations there.
  49.  
  50. On the original 128K and the 512K upgrade machines (which have a DB-9
  51. connector instead of the mini-Din-8) the Output Handshake line was held in a
  52. "marking" condition by hardware (a small resistor to the appropriate power
  53. supply rail). On later Macintoshes there are logic and a line driver for
  54. this line. This change introduces the following incompatabilities:
  55.  
  56.   1. SOME of the older terminal programs don't have the code to explicitly
  57.      drive HSKo high.
  58.   2. SOME terminal programs drop HSKo when they close down.
  59.   3. SOME modems require DTR and will drop carrier if DTR goes away.
  60.  
  61. If the cable design given below, mapping HSKo to DTR, is used, there are two
  62. recognized pathological conditions which can happen:
  63.  
  64.   A. Cannot use modem at all, because of 1 and 3 together.
  65.   B. Modem drops out when switching between terminal programs, 2 and 3
  66.      together.
  67.  
  68. Of course, some people consider B a feature, in that it will hang up the
  69. phone when you switch off the computer. Personally, I hang up the phone when
  70. I am done and I like to switch from terminal program to terminal program. If
  71. one of the above conditions happen, there are only three alternatives.
  72.  
  73.    * If at ALL possible, set your modem up to IGNORE DTR and stay connected.
  74.      Look for a DIP switch for this. I personally made this choice.
  75.    * Use only terminal programs which "properly" drive HSKo. You get to
  76.      operationally define "properly" :-)
  77.    * Drive DTR from DSR at the modem end of the cable, as described below.
  78.  
  79. Macintosh to modem (or other DCE device) NO HARDWARE HANDSHAKE:
  80.  
  81.        DIN-8 MALE                       DB-25 MALE
  82.  
  83.        GROUND 4 O--+--------------------O 7  GROUND
  84.   RECV DATA + 8 O--+
  85.  
  86.   RECV DATA - 5 O-----------------------O 3  RD (Receive Data)
  87.  
  88.   XMIT DATA - 3 O-----------------------O 2  TD (Transmit Data)
  89.  
  90. HANDSHAKE OUT 1 O--+
  91. HANDSHAKE  IN 2 O--+--------------------O 20 DTR (Data Terminal Ready)
  92.  
  93. Note that in RS-232 the data signals are inverted (marking is minus) while
  94. the control signals are not (marking is plus). Thus the transmit data minus
  95. signal from the Mac is just right for driving the modem. Leave the transmit
  96. data plus signal disconnected. If you ground this you will short out a
  97. driver, and it will probably get hot. Similarly the receive data signal from
  98. the modem/DCE is inverted, so it can drive the Mac's receive data minus
  99. line, but in this case the receive data plus line is grounded to prevent any
  100. extraneous signals from being induced into the circuit.
  101.  
  102. Note also that we are driving both HSKi and DTR from HSKo so the problems
  103. described above can happen. An alternative arrangement would drive these
  104. signals from the modem/DCE's source of DSR, like this:
  105.  
  106.  
  107.                                      +--O 6  DSR (Data Set Ready)
  108. HANDSHAKE  IN 2 O--------------------+--O 20 DTR (Data Terminal Ready)
  109.  
  110. Some dumb modems might require Request To Send (RTS) which one would wire
  111. like this:
  112.  
  113.                                      +--O 6  DSR (Data Set Ready)
  114. HANDSHAKE  IN 2 O--------------------+--O 20 DTR (Data Terminal Ready)
  115.                                      +--O 4  RTS (Request To Send)
  116.  
  117. Finally, if you have only 3-wire cable and don't need DTR shutdown, you can
  118. wire each side to be happy like this:
  119.  
  120. HANDSHAKE OUT 1 O--+                 +--O 6  DSR (Data Set Ready)
  121. HANDSHAKE  IN 2 O--+                 +--O 20 DTR (Data Terminal Ready)
  122.                                      +--O 4  RTS (Request To Send)
  123.  
  124. Macintosh to modem (or other DCE device) WITH hardware handshake:
  125.  
  126.        DIN-8 MALE                       DB-25 MALE
  127.  
  128.        GROUND 4 O--+--------------------O 7  GROUND
  129.   RECV DATA + 8 O--+
  130.  
  131.   RECV DATA - 5 O-----------------------O 3  RD (Receive Data)
  132.  
  133.   XMIT DATA - 3 O-----------------------O 2  TD (Transmit Data)
  134.  
  135. HANDSHAKE  IN 2 O-----------------------O 5  CTS (Clear To Send)
  136.  
  137. This cable connects the modem's CTS back to the Macintosh's input throttle
  138. HSkIn so the modem can throttle the Macintosh as needed.
  139.  
  140. HIGH SPEED MODEMS:
  141.  
  142. Many of the newer modems now do data compression and/or data rate conversion
  143. and so there is now a need for the computer and modem to be able to
  144. (temporarily) throttle output from each other. While there is a way defined
  145. in RS-232 for the modem to throttle the computer, there is no defined way
  146. for the computer to throttle the modem.
  147.  
  148. Vendors seem to have walked away from strict RS-232 in that they have
  149. redefined the meaning of the RTS (Request To Send) signal! This signal used
  150. to be used to tell the modem to acquire the communications medium for
  151. OUTPUT. Now it is being used to tell the modem that the computer is ready to
  152. take INPUT.
  153.  
  154. HANDSHAKE OUT 1 O-----------------------O 4  RTS (Request To Send [sic])
  155.  
  156. Thus this cable connects the Macintosh's ready signal HSkOut into the
  157. modem's RTS. Thus the Macintosh can throttle the modem when necessary.
  158. Depending on the program running on the Macintosh you may need to manually
  159. turn on handshaking by issuing the appropriate control call to the serial
  160. driver.
  161.  
  162. Lack of this wire usually causes the modem to be unable to send to the
  163. Macintosh. Sometimes the modem will ignore the signal when in command mode
  164. but require it when in data mode. The symptom here will be that the modem
  165. will answer commands and connect but will then act like the data receiver
  166. circuitry is disfunctional. If you need to know when the phone line is
  167. dropped (like for a bulletin board program that wants to know if it needs to
  168. ask for a password again) and you have a later model Macintosh that
  169. implements GPIn, you might want to wire DCD (Carrier Detect) into the
  170. general purpose input:
  171.  
  172. Gen Purp. In  7 O-----------------------O 8  DCD (Carrier Detect)
  173.  
  174. There is a Macintosh Technical Note describing the use of GPIn.
  175.  
  176. Macintosh to terminal (or other DTE device):
  177.  
  178.        DIN-8 MALE                      DB-25 FEMALE
  179.  
  180.        GROUND 4 O--+--------------------O 7  GROUND
  181.   RECV DATA + 8 O--+
  182.  
  183.   RECV DATA - 5 O-----------------------O 2  TD (Transmit Data)
  184.  
  185.   XMIT DATA - 3 O-----------------------O 3  RD (Recieve Data)
  186.  
  187. HANDSHAKE  IN 2 O-----------------------O 20 DTR (Data Terminal Ready)
  188.  
  189. The same analysis applies with respect to the data signals, except that in
  190. this case the transmit and receive are switched around, since one guy's
  191. transmit should be the other guy's receive and vice versa. Note receive data
  192. plus is again grounded while transmit data plus is left disconnected.
  193.  
  194. For this particular cable we have wired the terminal/DTE's DTR back into the
  195. Macintoshes HSKi to implement a hardware handshake. Assume the terminal side
  196. is a printer that is being overrun. One of the things these printers can do
  197. is drop DTR. By wiring it through to the handshake input we make it possible
  198. for the Macintosh software to temporarily pause in sending, until the
  199. printer's buffers empty out and the printer reasserts the DTR signal.
  200.  
  201. Some terminal devices may need to see DSR (Data Set Ready) or CD (Carrier
  202. Detect) or CTS (Clear to Send), in which case they may be driven from an
  203. appropriate source.
  204.  
  205.                                      +--O 20 DTR (Data Terminal Ready)
  206. This is probably appropriate         +--O 6  DSR (Data Set Ready)
  207. for a communications terminal        +--O 8  CD  (Carrier Detect)
  208. in which DTR is a totally static
  209. signal and does not move.            +--O 4  RTS (Request To Send)
  210.                                      +--O 5  CTS (Clear To Send)
  211.  
  212. or
  213.  
  214.                                      +--O 4  RTS (Request To Send)
  215. This is probably appropriate         +--O 6  DSR (Data Set Ready)
  216. for a printer that flaps DTR         +--O 5  CTS (Clear To Send)
  217. as the buffer fills and empties.     +--O 8  CD  (Carrier Detect)
  218.  
  219. The logic is to drive from whichever of DTR or RTS is NOT flapping around as
  220. buffers fill and empty or as the terminal transmits and receives...
  221.  
  222. To connect directly to an IBM PC we believe CD must be asserted. That is, an
  223. IBM PC will not accept data unless it also sees the CD signal.
  224.  
  225. IBM PC to Apple LaserWriter
  226.  
  227. Yeah, this is a strange little topic, but we figured out how to do it so I
  228. thought I would throw it in. Thanks to Mike Petry and Steve Ostrove for
  229. figuring out how to do this.
  230.  
  231.                  IBM PC (DB25)                 Apple LaserWriter (DB25)
  232.  
  233.       (Transmit Data) TD   2 O-----------------O 3  RD (Receive Data)
  234.        (Receive Data) RD   3 O-----------------O 2  TD (Transmit Data)
  235.       (Clear To Send) CTS  5 O-----------------O 20 DTR (Data Terminal Ready)
  236.  
  237.      (Data Set Ready) DSR  6 O--+
  238.      (Carrier Detect) DCD  8 O--+
  239. (Data Terminal Ready) DTR 20 O--+
  240.  
  241.       (Signal Ground) GND  7 O-----------------O 7 GND (Signal Ground)
  242.  
  243. Note that the PC's DTR is used to make it think there is a modem connected
  244. and turned on (DSR) and that a carrier is present (DCD). The LaserWriter's
  245. DTR is used to throttle the PC's output using its CTS input.
  246.  
  247. CLASSIC MACINTOSH
  248.  
  249. Somebody on comp.sys.mac.hardware asked for cables for a Classic Mac! I
  250. didn't know there were any more of those out there!!! :-) Here are the
  251. corresponding connections, please use these in conjunction with the analysis
  252. and suggestions provided above:
  253.  
  254. Classic Macintosh to modem (or other DCE device):
  255.  
  256.       DB-9 MALE                       DB-25 MALE
  257.  
  258.      GROUND 3 O--+--------------------O 7  GROUND
  259. RECV DATA + 8 O--+
  260.  
  261. RECV DATA - 9 O-----------------------O 3  RD (Receive Data)
  262.  
  263. XMIT DATA - 5 O-----------------------O 2  TD (Transmit Data)
  264.  
  265.  + 12 Volts 6 O--+
  266.   HANDSHAKE 7 O--+--------------------O 20 DTR (Data Terminal Ready)
  267.  
  268. Classic Macintosh to terminal (or other DTE device):
  269.  
  270.       DB-9 MALE                       DB-25 FEMALE
  271.  
  272.      GROUND 3 O--+--------------------O 7  GROUND
  273. RECV DATA + 8 O--+
  274.  
  275. RECV DATA - 9 O-----------------------O 2  TD (Transmit Data)
  276.  
  277. XMIT DATA - 5 O-----------------------O 3  RD (Receive Data)
  278.  
  279.   HANDSHAKE 7 O-----------------------O 20 DTR (Data Terminal Ready)
  280.  
  281. FINAL CLOSURE
  282.  
  283. On the DB-25 pin 1 is the FRAME ground and pin 7 is the SIGNAL ground.
  284. Equipment that requires connection to pin 1 is badly designed (IMHO). As a
  285. very last resort you might try a 1 to 7 jumper.
  286.  
  287. As you can imagine from seeing all these alternatives, an RS232 breakout box
  288. is real handy, since you can try all these patches without having to warm up
  289. a soldering iron. The only other thing I can say is:
  290.  
  291.      IF IT DON'T WORK, DON'T LEAVE IT TURNED ON LONG ENOUGH TO GET HOT!
  292.  
  293. Communications driver chips are built very ruggedly and will stand an
  294. amazing amount of mistreatment for a short period of time. But if you let
  295. two drivers fight for an hour one or both of them will burn out...
  296.  
  297. I've read this over a dozen times to make sure there aren't any totally
  298. glaring errors, but I cannot be responsible for anybody's smoked hardware.
  299. Let's be careful out there!
  300.  
  301. Ben Cranston <zben@ni.UMD.EDU>
  302. Network Infrastructures Group
  303. Computer Science Center
  304. University of Maryland at College Park
  305. of Ulm
  306. ----------------------------------------------------------------------------
  307. Back to ZBEN's home page.
  308.